/*
 * sender_service.h
 *
 *  Created on: 2008-12-23
 *      Author: fanliangliang
 */

#ifndef SENDER_SERVICE_H_
#define SENDER_SERVICE_H_

#include "base_service.h"
#include "application.h"
#include "toxic.h"

using namespace toxic;

class SenderService : public BaseService {
public:
	SenderService(const char* serviceName)
	:BaseService(serviceName)
	,isRunning_(true) {

	}

	virtual ~SenderService() {

	}

	virtual void stop() {
		isRunning_ = false;
	}

	virtual void run() {
		try {
			application_.load("dataupdate.xml");
			application_.start();
			while (isRunning_) {
				Thread::sleep(200);
			}
			application_.stop();
		}
		catch (const exception& e) {
			// TODO
		}
	}

private:
	Application application_;
	volatile bool isRunning_;
};

#endif /* SENDER_SERVICE_H_ */
